package com.fl.chinesemedicen;

import android.app.Activity;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.SystemClock;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.LinearLayout;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class FlashActivity extends Activity {
    private LinearLayout ll;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_flash);
        ll = (LinearLayout) findViewById(R.id.activity_flash);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Drawable dra = getDrawable(R.drawable.pushmain_bg);
            ll.setBackground(dra);
        }
        startActivity(new Intent(this,MainActivity.class));
        finish();
//        new Thread(){
//            @Override
//            public void run() {
//                SystemClock.sleep(2000);
//                startActivity(new Intent(FlashActivity.this,MainActivity.class));
//                finish();
//            }
//        }.start();
    }

    private void copyAddrDB(String name, File file) {
        if (file.exists()) {
            file.delete();
        }

        // 拷贝
        try {
            InputStream is = getAssets().open(name);    // 获取数据库库文件输入流
            FileOutputStream fos = new FileOutputStream(file);  // 定义输出流
            byte[] bt = new byte[8192];
            int len = -1;
            while ((len = is.read(bt)) != -1) {
                fos.write(bt, 0, len);
            }
            is.close();
            fos.close();

        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
